﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.Reflection;


public class ResponseData
{
    public ResponseData()
    {

    }
    public ResponseData(string result)
    {
        _Body = result;
        JObject jo = (JObject)JsonConvert.DeserializeObject(result);
        if (jo != null)
        {
            JToken d = jo["d"];
            if (d != null)
            {
                _Code = (d["Code"] == null) ? "" : d["Code"].ToString();
                _Msg = (d["Msg"] == null) ? "" : d["Msg"].ToString();
                _Data = (d["Data"] == null) ? "" : d["Data"].ToString();
                _ErrCode = (d["ErrCode"] == null) ? "" : d["ErrCode"].ToString();
                _ErrMsg = (d["ErrMsg"] == null) ? "" : d["ErrMsg"].ToString();
            }
        }
    }

    private string _Body;
    
    public string Body
    {
        get { return _Body; }
        set { _Body = value; }
    }

    private string _Code;
    /// <summary>
    /// 代号
    /// </summary>
    
    public string Code
    {
        get { return _Code; }
        set { _Code = value; }
    }

    private string _Msg;
    /// <summary>
    /// 返回信息
    /// </summary>
    
    public string Msg
    {
        get { return _Msg; }
        set { _Msg = value; }
    }

    private string _Data;
    /// <summary>
    /// 返回Json结果数据
    /// </summary>
    
    public string Data
    {
        get { return _Data; }
        set { _Data = value; }
    }

    private string _ErrCode;
    /// <summary>
    /// 错误码
    /// </summary>
    
    public string ErrCode
    {
        get { return _ErrCode; }
        set { _ErrCode = value; }
    }

    private string _ErrMsg;
    /// <summary>
    /// 错误信息
    /// </summary>
    
    public string ErrMsg
    {
        get { return _ErrMsg; }
        set { _ErrMsg = value; }
    }

    private int _TotalCount;
    /// <summary>
    /// 总数
    /// </summary>
    
    public int TotalCount
    {
        get { return _TotalCount; }
        set { _TotalCount = value; }
    }

    private bool _IsSuccess;
    
    public bool IsSuccess
    {
        get
        {
            if (string.IsNullOrEmpty(_ErrMsg))
            {
                _IsSuccess = true;
            }
            return _IsSuccess;
        }
        set { _IsSuccess = value; }
    }

    private Dictionary<string, bool> _Rights = new Dictionary<string, bool>();
    
    public Dictionary<string, bool> Rights
    {
        get { return _Rights; }
        set { _Rights = value; }
    }
}